|
In computer science, and in particular functional programming, a hylomorphism is a recursive function, corresponding to the composition of an anamorphism (which first builds a set of results; also known as 'unfolding') followed by a catamorphism (which then folds these results into a final return value). Fusion of these two recursive computations into a single recursive pattern then avoids building the intermediate data structure. This is an example of deforestation, a program optimization strategy. A related type of function is a metamorphism, which is a catamorphism followed by an anamorphism. ==Formal definition== A hylomorphism can be defined in terms of its separate anamorphic and catamorphic parts. The anamorphic part can be defined in terms of a unary function defining the list of elements in by repeated application (''"unfolding"''), and a predicate providing the terminating condition. The catamorphic part can be defined as a combination of an initial value for the fold and a binary operator used to perform the fold. Thus a hylomorphism : (where ) may be defined (assuming appropriate definitions of & ). 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Hylomorphism (computer science)」の詳細全文を読む スポンサード リンク
|